﻿<controls:FloatableWindow x:Class="A_ManageUsers.NewUser"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=FloatableWindow"
           Width="400" Height="300" 
                      xmlns:dm="clr-namespace:DataModel;assembly=DataModel"
           Title="New User"  HasCloseButton="False">
    <controls:FloatableWindow.Resources>
        <dm:SaveChangesCommand x:Key="SaveChanges" />
        <dm:CancelChangesCommand x:Key="CancelChanges" />
    </controls:FloatableWindow.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock>Username</TextBlock>
            <TextBox Grid.Column="1" Text="{Binding Path=UserName, Mode=TwoWay}" Margin="2"  x:Name="Input"/>
            <TextBlock Grid.Row="1">Comment</TextBlock>
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=Comment, Mode=TwoWay}" Margin="2"/>
            <TextBlock Grid.Row="3">Roles</TextBlock>
            <ListBox ItemsSource="{Binding Path=UserRoles}" Grid.Row="3" Grid.Column="1" Margin="2" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox IsChecked="{Binding Path=Enabled, Mode=TwoWay}" Content="{Binding Path=RoleName}"/>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
        <Button Command="{StaticResource CancelChanges}" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
        <Button Command="{StaticResource SaveChanges}" Content="Save" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
    </Grid>
</controls:FloatableWindow>